export function fileToBase64(file: File) {
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => resolve(reader.result);
        reader.onerror = err => reject(err);
    });
}

/**
 * @param path public文件夹下的文件路径, 以./开头
 */
export function getPublicAssets(path: string) {
    return `${process.env.PUBLIC_URL}${path.slice(1)}`;
}